package encaps.utils.search;

import encaps.entities.OrderType;
import encaps.entities.Role;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class SearchContext {

    private int page;
    private int pageCount;
    private int recordsPerPage;
    private int fromRecord;
    private String entityType;
    private String actionName;
    private Role userRole;
    private Map<String, String> searchParameters;
    private String orderColumn;
    private OrderType orderType;
    private boolean isBasicSearch;

    public SearchContext(boolean isBasicSearch) {
        searchParameters = new HashMap<String, String>();
        this.isBasicSearch = isBasicSearch;
    }

    /**
     * *******************************
     */
    public String getEntityType() {
        return entityType;
    }

    public void setEntityType(String entityType) {
        this.entityType = entityType;
    }

    /**
     * *******************************
     */
    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    /**
     * *******************************
     */
    public int getPageCount() {
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }

    /**
     * *******************************
     */
    public int getRecordsPerPage() {
        return recordsPerPage;
    }

    public void setRecordsPerPage(int recordsPerPage) {
        this.recordsPerPage = recordsPerPage;
    }

    /**
     * *******************************
     */
    public int getFromRecord() {
        return fromRecord;
    }

    public void setFromRecord(int fromRecord) {
        this.fromRecord = fromRecord;
    }

    /**
     * *******************************
     */
    public String getActionName() {
        return actionName;
    }

    public void setActionName(String actionName) {
        this.actionName = actionName;
    }

    /**
     * *******************************
     */
    public Role getUserRole() {
        return userRole;
    }

    public void setUserRole(Role userRole) {
        this.userRole = userRole;
    }

    /**
     * *******************************
     */
    public void addSearchParameter(String name, String value) {
        searchParameters.put(name, value);
    }

    public String getSearchParameter(String name) {
        return searchParameters.get(name);
    }

    public Iterator<String> getSearchParametersIterator() {
        return searchParameters.keySet().iterator();
    }

    public int searchParametersCount() {
        return searchParameters.size();
    }

    /**
     * *******************************
     */
    public boolean isBasicSearch() {
        return isBasicSearch;
    }

    /**
     * *******************************
     */
    public String getOrderColumn() {
        return orderColumn;
    }

    public void setOrderColumn(String orderColumn) {
        this.orderColumn = orderColumn;
    }

    /**
     * *******************************
     */
    public OrderType getOrderType() {
        return orderType;
    }

    public void setOrderType(OrderType orderType) {
        this.orderType = orderType;
    }
}
